var api = require('../../util/api.js');
Page({
    data: {

    },
    onLoad: function () {
        let chain = api.chain();
        this.setData({
            page: api.page(10),
            dataList: [],
            params: {
                examineId: chain.examineId,
                userId: chain.userId
            }
        });
        this.onReachBottom();
    },
    onPullDownRefresh() {
        this.setData({
            page: api.page(5),
            dataList: []
        });
        this.loadList();
    },
    onReachBottom() {
        this.loadList();
    },
    loadList() {
        var _this = this;
        var params = _this.data.params;
        var page = _this.data.page;
        api.get(`${api.ip}ljjd/zgd/zgdList`, params, page).then(res => {
            page.setTotal(res.total);
            if (res.rows.length == 0) {
                this.setData({
                    hasData: false
                })
            } else {
                _this.setData({
                    hasData: true,
                    dataList: _this.data.dataList.concat(res.rows)
                });
            }
        })
    }

})